We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

PDO::ATTR_CASE => PDO::CASE_LOWER

Hey guys,

I've been doing some testing on phalcon and i've come across a strange issue. This is my database config:

$di->set('db', function () {
    return new \Phalcon\Db\Adapter\Pdo\Mysql(array(
        "host" => "localhost",
        "username" => "***",
        "password" => "**",
        "dbname" => "***",
        "options" => array(
            PDO::ATTR_CASE => PDO::CASE_LOWER
        )
    ));
});

The query results are returned with lower case columns, but whenever I construct a query I have to use lower and uppercase for the columns I am querying otherwise it throws an error (example below the column is actually "UserID")

PhalconException: Column 'userid' doesn't belong to any of the selected models (1), when preparing: SELECT [Users].* FROM [Users] WHERE userid='benksd'

Is there anyway to fix this?



98.9k

If the case changes Phalcon ORM can't access the expected keys when getting data from the database